import axios from 'axios'
import qs from 'qs'
const baseUrl = axios.create({
  baseURL: '/qiniu',
  timeout: 8000
})

//axios请求前处理
baseUrl.interceptors.request.use(config => {
  let token = window.sessionStorage.getItem('token')
  config.headers.token = token
  config.data = qs.stringify(config.data);
  config.headers["Content-Type"] = "application/x-www-form-urlencoded"
  return config
})

//axios请求后返回数据的处理
baseUrl.interceptors.response.use(config => {
  return config
})


export default baseUrl